A Smarter Doorbell - Part 1
Published in Electronics At home we have one of the Swann portable doorchimes that you commonly see at hardware/DIY shops, which works fine but is a bit limited in terms of the receiver battery life. We don't particularly need to move the receiver, so it would be much easier to leave it plugged in somewhere. But hey, if I'm opening the case what else could I add? Enter the Photon, a matchbox sized Arduino-style internet-of-things development board. This module aims make it dead easy to connect simple and cheap devices to the Internet, to make them smarter.
But first, let's take a look inside the doorbell receiver. The board is two-sided, but no components at all are mounted on the bottom side. The striped wires in the first photo above connect to the speaker hidden behind the circuit board. Even though the board's nominal input voltage is 4.5 volts (3 AA batteries/cells), it seems to be tolerant of a fairly wide input range. Fresh batteries provide more than 1.5V, meanwhile some fairly low NiMH rechargeable AA batteries will still drive it so I guess its input voltage range really runs from 5.0V down to 2.5V. A quick test demonstrated that the Photon's 3.3V regulated output can drive the receiver. The brown wire shown above connects the Photon's D0 pin to the receiver's one LED which always blinks when the doorbell is ringing. No surprises there, D0 reads high when the LED is on reads low the rest of the time because the LED sinks directly to board's ground plane. The original goal of the project was to provide a permanent power option for the doorbell receiver. The button unit outside is going fine, since that only has to be "on" when someone has pressed the button. The receiver on the other hand always has to be "live" so it can listen for signals from its counterpart, leading to disappointing battery life. The solution is to add a dual-power option so it can run off USB or batteries. So the first job was to find a spare USB cable.
Conveniently, I still had this old Apple-style 30 pin charging cable that had been thrown in with a car charger kit from a supermarket. I discovered after the fact that it was in fact a fully-fledged 30 pin USB cable with 4 conductors and quite well put together with respectably thick power wires and shield wires running the length of the cable. The Photon is tolerant of input voltages from 5.5V to 3.6V, suitable for direct connection to a USB charger (which sometimes run at 5.2V or 5.3V under light loads if not so well regulated). Not keen to push the limits of the receiver's input voltage range, I'm opting for an arrangement where the receiver would be powered through the Photon's 3.3V output on a USB power supply, meanwhile on a battery supply the receiver would power the Photon directly to its V-In pin. The test rig above also includes an extra diode to isolate the USB input when the receiver is running on battery power. This is for two reasons - to stop the batteries putting a strange voltage on the USB line if it happens to be plugged in, and also to provide provide a good digital indicator for presence of absence of a USB power source. A 120MHz SoC is awfully overpowered for something that just has to send a signal to the Internet when a line goes high. Before making this project up on a permanent board, I'd like to add another couple of elements like an ambient temperature sensor and maybe an indication of today's weather driven by a service running on another server. Part 2 of this post will cover the extra sensors or outputs that make it in to the project and final assembly. Adding intelligence
Compared to the ATMega 328, The Photon has a much faster CPU (120Mhz vs 16Mhz), more flash space (1MB vs 128KB) and more RAM (128KB vs 2KB). This is handy, since the software design is closer to that of a "computer" than a microcontroller, with the OS continuing to run alongside user code to manage the connection state. The OS connects to Particle's hosted web API that lets your device publish and receive both events and variables for other applications to interact with easily.Inside the receiver
Getting power in
Anything else?